
import axios from 'axios';

const apiClient = axios.create({
    baseURL: 'http://localhost:6062',
    timeout: 5000,
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${localStorage.getItem('token')}`
    }
});

// 预约相关API
export const appointmentApi = {
    // 获取患者预约列表
    async getPatientAppointments(patientId) {
        try {
            const response = await apiClient.get(`/appointments/patient/${patientId}`);
            return response.data;
        } catch (error) {
            console.error('获取预约列表失败:', error);
            throw error;
        }
    },

    // 刷新预约数据
    async refreshAppointments(patientId) {
        return this.getPatientAppointments(patientId);
    }
};
